<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
            width: 250px;
            float: left;
            padding: 0 600px;
        }

        .mi {
            float: left;
            height: 100px;
            width: 200px;
        }

        input {
            float: left;
            height: 50px;
            width: 200px;
            border: 1px solid blue;
        }

        .result-list {
            display: none;
            border: 1px solid blue;
        }

        a {
            text-decoration: none;
            color: black;
        }

        li:hover {
            background-color: yellow;

        }

        a:hover {
            color: red;
        }

        .result-list li {
            list-style: none;
            padding: 10px 20px;
            /* background-color: chartreuse; */
            border: 1px solid blue;

        }

        button {
            display: block;
            height: 50px;
            width: 50px;
            float: left;
        }

        .search {
            /* color: red; */
            /* background-color: cyan; */
            border: 1px solid blue;
        }
    </style>
</head>

<body>
    <div class="box">
        <di class="mi">
            <input type="search" placeholder="小米笔记本">
            <ul class="result-list">
                <li><a href="#">全部商品</a></li>
                <li><a href="#">小米11</a></li>
                <li><a href="#">小米10s</a></li>
                <li><a href="#">小米笔记本</a></li>
                <li><a href="#">小米手机</a></li>
                <li><a href="#">空调</a></li>
                <li><a href="#">iPhone 18 pro max</a></li>
            </ul>
        </di>
        <div class="text">
            <button>搜索</button>
        </div>
    </div>
    <script>
        const input = document.querySelector('input')
        const ul = document.querySelector('.result-list')
        input.addEventListener('focus', function () {

            ul.style.display = 'block'
            input.classList.add('search')
        })
        input.addEventListener('blur', function () {
            ul.style.display = 'none'
            input.classList.remove('search')
        })

    </script>
</body>

</html>